import 'package:flutter_ohos/generated/json/base/json_convert_content.dart';
import 'package:flutter_ohos/app/modules/fourth/model/person_entity.dart';

PersonEntity $PersonEntityFromJson(Map<String, dynamic> json) {
  final PersonEntity personEntity = PersonEntity();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    personEntity.name = name;
  }
  final int? age = jsonConvert.convert<int>(json['age']);
  if (age != null) {
    personEntity.age = age;
  }
  return personEntity;
}

Map<String, dynamic> $PersonEntityToJson(PersonEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['age'] = entity.age;
  return data;
}

extension PersonEntityExtension on PersonEntity {
  PersonEntity copyWith({
    String? name,
    int? age,
  }) {
    return PersonEntity()
      ..name = name ?? this.name
      ..age = age ?? this.age;
  }
}